//
// Created by 26364 on 2025/11/2.
//

#ifndef BOOTLOADER_MY_SPI_H
#define BOOTLOADER_MY_SPI_H
#include <main.h>
#define EN_CS     0
#define SPI_CLK_PIN        GPIO_PIN_14
#define SPI_CLK_PORT       GPIOH
#define SPI_CS_PIN
#define SPI_CS_PORT
#define SPI_MOSI_PIN       GPIO_PIN_6
#define SPI_MOSI_PORT      GPIOI
#define SPI_MISO_PIN       GPIO_PIN_3
#define SPI_MISO_PORT      GPIOD
#define SPI_MOSI(x)         do{HAL_GPIO_WritePin(SPI_MOSI_PORT,SPI_MOSI_PIN, x);}while (0);
#define SPI_MISO            HAL_GPIO_ReadPin(SPI_MISO_PORT,SPI_MISO_PIN)
#define SPI_SCL(x)          do{HAL_GPIO_WritePin(SPI_CLK_PORT,SPI_CLK_PIN, x);}while (0);
#if EN_CS == 1
#define SPI_CS(x)           do{HAL_GPIO_WritePin(SPI_CS_PORT,SPI_CS_PIN, x);}while (0)
#else
#endif
typedef void (*update_callback_SPI_t)(uint8_t flag);
void My_Spi_Init();
void Updata_loop();
void set_update_Spi_complete_callback(update_callback_SPI_t callback);
void set_update_Spi_Begin_callback(update_callback_SPI_t callback);
void set_update_Spi_Block_callback(update_callback_SPI_t callback);
#endif //BOOTLOADER_MY_SPI_H
